/*
 * @(#)AlarmBeanCountEsImpl.java   1.0  2022年3月16日
 * 
 * Copyright (c)	2014-2020. All Rights Reserved.	GuangZhou hhmk Technology Company LTD.
 */
package com.swift.monitor.core.alarm;

import java.io.IOException;

import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentFactory;
import org.springframework.stereotype.Component;

import com.swift.monitor.core.point.BeanCountPoint;

/**
 * 添加说明 
 * @author zhengjiajin
 * @version 1.0 2022年3月16日
 */
@Component
public class AlarmBeanCountEsImpl extends AabstractAlarmEsImpl<BeanCountPoint> {

    private static final String ES_TABLE = "swift_monitor_bean_count";
    /** 
     * @see com.swift.monitor.core.alarm.AabstractAlarmEsImpl#getESTable()
     */
    @Override
    public String getESTable() {
        return ES_TABLE;
    }
    /** 
     * @see com.swift.monitor.core.alarm.AabstractAlarmEsImpl#getESMapping()
     */
    @Override
    public XContentBuilder getESMapping() {
        try {
            XContentBuilder mapping = XContentFactory.jsonBuilder()
                .startObject()
                    .startObject("properties")
                        .startObject("pointTime").field("type", "date").field("format", "epoch_millis").endObject()
                    .endObject()
                .endObject();
            return mapping;
        } catch (IOException e) {
            return null;
        }
    }

}
